
from xpinyin import Pinyin

def convert_to_pinyin():
    p = Pinyin()
    # 基本转换
    print(p.get_pinyin("你好"))  # 输出: ni-hao
    print(p.get_pinyin("你好", tone_marks=True))  # 输出: nǐ-hǎo
    
    # 自定义分隔符
    print(p.get_pinyin("北京", splitter=''))  # 输出: bei jing
    
    # 获取首字母
    print(p.get_initials("上海"))  # 输出: SH
    print(p.get_initials("上海", splitter='-'))  # 输出: S-H

if __name__ == "__main__":
    convert_to_pinyin()
